package singleton.test;

import com.gupao.edu.study.singleton.Lazy;

import java.util.concurrent.CountDownLatch;

public class LazyTestDemo {
    public static void main(String[] args) {
        int count = 500;
        long starter = System.currentTimeMillis();
        CountDownLatch countDownLatch = new CountDownLatch(count);
        for (int i = 0; i < count; i++) {
            new Thread(() -> {
                Lazy lazy = Lazy.getInstance();
                System.out.println(System.currentTimeMillis() +":"+lazy);
                countDownLatch.countDown();
            }).start();
        }
        try {
            countDownLatch.await();
            long end = System.currentTimeMillis();
            System.out.println("总计耗时" + (end - starter));
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

    }
}
